//
//  CJComposeButton.swift
//  SinaWeibo
//
//  Created by 程建 on 16/10/6.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

let composeBtnH:CGFloat = 110
let composeBtnW:CGFloat = 80

class CJComposeButton: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        //设置初始设置
        titleLabel?.font = UIFont.systemFont(ofSize: 15)
        titleLabel?.textAlignment = .center
        setTitleColor(UIColor.darkGray, for: .normal)
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    
    
    //已知按钮的大小,计算文字的大小
    override func titleRect(forContentRect contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: composeBtnW, width: composeBtnW, height: composeBtnH - composeBtnW)
    }

    override func imageRect(forContentRect contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: 0, width: composeBtnW, height: composeBtnW)
    }
    
}
